<template>
  <div class="boxes">
    <a-drawer
        :body-style="{ height: '100%'}"
        :visible="visible"
        :width="1300"
        title="审批设置"
        @close="handleEditSuccess"
    >
      <SetApproval v-if="visible" style="height: 100%;"/>
    </a-drawer>
  </div>
</template>

<script>
import {defineComponent, reactive, toRefs} from "vue";
import {useRoute} from "vue-router";
import utils from "@/common/utils/utils";
import SetApproval from "@/views/Approval/SetApproval/index.vue";


export default defineComponent({
  name: "carList",
  components: {SetApproval},
  setup() {
    const $route = useRoute();
    const state = reactive({
      visible: false,
    });
    const handleEditSuccess = () => {
      state.visible = false;
      // 通知主应用关闭
      window.microSendMessage();
      window.parent.postMessage(
          {
            status:'Approve',
            params: {
              gw : true,
            }
          },
          "*"
      );
    };

    const init = () => {
      state.visible = true
    };

    init();

    return {
      ...toRefs(state),
      handleEditSuccess,
    };
  },
});

</script>
<style lang="less" scoped>
#app {
  background: rgba(240, 242, 245, 0);
}
</style>